﻿<%@ page language="java" contentType="text/html;charset=utf-8"
	pageEncoding="utf-8"%>
	
<%@ page import="com.sms.project.*" %>
<%@ page import="java.util.List, java.util.ArrayList, java.util.Map" %>

<%--
	project/teacher/item-details.jsp
 --%>

<%	//清除内存
	response.setHeader("Pragma","No-cache"); 
	response.setHeader("Cache-Control","no-cache"); 
	response.setDateHeader("Expires", 0); 
%> 


<%
	request.setCharacterEncoding("utf-8");
	String userno = (String)session.getAttribute("userno");
	
	String row = request.getParameter("row");//获取该项目是第几行的参数(从0开始的)
	int num = Integer.parseInt(row);
	Project p = null;

	String progress = request.getParameter("progress");
	String condition = "";
	if(progress != null) {
		if(progress.trim().equals("already")) {
			condition = "finish";
		} else if(progress.trim().equals("unalready")){
			condition = "notfinish";
		} else {
			condition = "";
		}
	} else {
		condition = "";
	}

	//得到该项目的对象并赋值
	List<Project> list = new ArrayList<Project>();
	list = Task.getLProject(userno, condition, "member");
	if(list != null && list.size() > 0) {
		p = (Project)list.get(num);
	} else {
		return;
	}
	
%>		

 <%
	List<String> member = p.getMember();
	String memberString = "";
	if(member != null) {
		for(int i=0; i<member.size(); i++) {
			String memberName = member.get(i).toString();
			memberString += memberName + ",";
		}
	}
	
 %>	

<body>
<div id="project">
<form id="project-details" onSubmit="return false">
<table cellpadding="0" cellspacing="0">
    <tr><td><label for="name">项目名称:</label></td><td style="text-align:left;height:30px;"><%= p.getProName() %></td></tr>
    <tr><td><label for="desc">项目描述:</label></td><td><textarea cols=30 rows=5><%= p.getContent() %></textarea></td></tr>  
    <tr><td><label for="begintime" style="width:110px;">任务开始时间：</label></td><td style="text-align:left;height:30px;"><%= p.getStartTime() %></td></tr> 
    <tr><td><label for="deadline" style="width:110px;">任务截止时间：</label></td><td style="text-align:left;height:30px;" id="changetime"><%= p.getEndTime() %></td></tr> 
     <tr><td><label for="header">项目组长：</label></td><td style="text-align:left;height:30px;" id="changeLeader"><%= p.getLeaderName() %></td></tr>
      <tr><td><label for="member">项目组员：</label></td><td id="changeMember" style="text-align:left;height:30px;"><%= memberString %></td></tr> 
     <% 
     	List<Map> appendFile = null;
		//如果有附件
		if(p.getIsAppend().equals("1")) {
			appendFile = new ArrayList<Map>();
			appendFile = p.getAppendFile();
     %>  
      		<tr class="addfiles"><td><label for="file">附件链接：</label></td>
      		<td style="text-align:left;height:30px;">
      <% 
      		for(int i=0; i<appendFile.size(); i++) {
      				Map<String, String> map = (Map<String, String>)appendFile.get(i);
					String fileName = (String)map.get("fileName");
					String saveName = (String)map.get("saveName");
      %>
      			<a href="DownServlet?fileName=<%= fileName %>&saveName=<%= saveName %>"><%= fileName %></a>&nbsp;&nbsp;
      <%
      		}
      %>
      
      		</td></tr>
      <% }%> 
</table>
</form>
</div>
</body>


